<template>
  <div id="app">
    <login v-show="loginVisible" v-on:admin="loginAdmin"></login>
    <welcome v-show="welcomeVisible"></welcome>
  </div>
</template>

<script>
import login from './components/login'
import welcome from './components/welcome'

export default {
  name: 'app',
  data () {
    return {
      loginVisible: false,
      welcomeVisible: true
    }
  },
  /**
   * 判断cookie中是否有 token 值,如果有跳转到book,没则打开登录
   */
  methods: {
    loginAdmin () {
      this.loginVisible = false
      this.welcomeVisible = true
    }
  },
  components: {
    login, welcome
  }
}
</script>
